package conf_service

import (
	"encoding/json"
	"peilian-api/app/global/common"
	"peilian-api/app/global/databases/tables"
	"peilian-api/app/model"
)

type ConfService struct{}

func (cf *ConfService) GetEducationList() (arr []string) {
	// var cfArr tables.CommonConf
	// d := variable.DB.MySQL.Where("conf_key = 'education' and type = 2").Find(&cfArr)
	// if d.Error != nil {
	// 	return common.EducationArr
	// }
	// json.Unmarshal([]byte(cfArr.ConfValue), &arr)
	return common.EducationArr
}

// 获取年级列表
func (cf *ConfService) GetGradeList() (arr []string) {
	return common.GradeArr
}

// 获取前置视频
func (cf *ConfService) GetProfont() (arr []model.ProfontResp) {
	cc, _ := new(tables.CommonConf).FetchByTypeKey(tables.ConfKeyProfontVideo, tables.ProfontVideo)
	json.Unmarshal([]byte(cc[0].ConfValue), &arr)
	// dec := json.NewDecoder(strings.NewReader(cc.ConfValue))
	// dec.Decode(&arr)
	return arr
}

// 获取人员类型
func (cf *ConfService) GetStafList() (arr []string) {
	return tables.StafArr
}
